import 'dart:convert';

import 'package:dart_mappable/dart_mappable.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';

import '../../../bean/KeyValueBean.dart';

class EmployerDetailUpdateController extends GetxController {
  var  suqiugongzhong=KeyValueBean.keyValue().obs;
  var  fuzhugongzhong=KeyValueBean.keyValue().obs;
  var  xinchou=KeyValueBean.keyValue().obs;
  var xingbie =KeyValueBean.keyValue().obs;
  var gongzuozhidu =KeyValueBean.keyValue().obs;
  var gongzuoshuxing =KeyValueBean.keyValue().obs;
  var zygznr="".obs;
  var   keyValueBean= KeyValueBean().obs;
  final TextEditingController controller_glypl = TextEditingController(text: '默认值');

  Future<void> initSelectData() async {
    final jsonStr = await rootBundle.loadString('assets/config_employer.json');
    keyValueBean.value= KeyValueBeanMapper.fromJson(jsonStr);

  }
  ////////////页面处理//////////////////

  final ScrollController scrollController = ScrollController();
  final List<GlobalKey> titles = [
    GlobalKey(debugLabel: 'qwsq'),
    GlobalKey(debugLabel: 'jbxx'),
    GlobalKey(debugLabel: 'gwxx'),
    GlobalKey(debugLabel: 'jjrpl'),
  ];

  void scrollTo(GlobalKey key) {
    final context = key.currentContext;
    if (context != null) {
      Scrollable.ensureVisible(
        context,
        duration: const Duration(milliseconds: 500),
        alignment: 0.0, // 0.0 表示滚动到顶部
        curve: Curves.easeInOut,
      );
    }
  }
}